/*
 *  $Id: Undead.cs 975 2009-12-16 17:13:22Z thenn.erannor $
 *	This file is a part of Ragima CCG.
 *	(C) 2008 Ragima development group.
 *
 *	Licensed under the terms of the GNU GPL License version 2.
 *
 */

namespace Ragima.Affects {
    /// <summary>
    /// Эффект: нежить (флаг)
    /// Существо с этим эффектом является нежитью, и для него действие лечения и тьмы обратны.
    /// </summary>
    public class Undead: FlagAffect {
        private Absorb _health, _darkness;

        public Undead() {
            _health = Absorb.OnlyHeal(DamageType.Health);
            _darkness = Absorb.OnlyDamage(DamageType.Darkness);
        }

        public override string Id {
            get { return "undead"; }
        }

        public override ElementType Element {
            get { return ElementType.Darkness; }
        }

        public override int GetWeight(Card card) {
            return Element == card.Element ? 10 : -20;
        }

        public override AffectIcon Icon {
            get { return AffectIcon.Undead; }
        }

        public override bool Dispellable {
            get { return false; }
        }

        public override void SetAffect() {
            base.SetAffect();
            LocalSummary.HealAbsorbs.Add(_health);
            LocalSummary.DamageAbsorbs.Add(_darkness);
        }
        public override void ResetAffect() {
            base.ResetAffect();
            LocalSummary.HealAbsorbs.Remove(_health);
            LocalSummary.DamageAbsorbs.Remove(_darkness);
        }
    }
}